package com.ruoyi.background.service.impl;

import com.ruoyi.background.domain.AppRankDept;
import com.ruoyi.background.domain.AppRankUser;
import com.ruoyi.background.mapper.AppRankDeptMapper;
import com.ruoyi.background.service.IAppRankDeptService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 部门排名表Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-23
 */
@Service
public class AppRankDeptServiceImpl implements IAppRankDeptService {
    @Autowired
    private AppRankDeptMapper appRankDeptMapper;

    /**
     * 查询部门排名表
     *
     * @param id 部门排名表主键
     * @return 部门排名表
     */
    @Override
    public AppRankDept selectAppRankDeptById(Long id) {
        return appRankDeptMapper.selectAppRankDeptById(id);
    }

    /**
     * 通过部门id查询
     *
     * @param deptId 部门的id
     * @return 结果
     */
    @Override
    public AppRankDept selectAppRankDeptByUserDeptId(Long deptId) {
        return appRankDeptMapper.selectAppRankDeptByDeptId(deptId);
    }

    /**
     * 查询部门排名表列表
     *
     * @param appRankDept 部门排名表
     * @return 部门排名表
     */
    @Override
    public List<AppRankDept> selectAppRankDeptList(AppRankDept appRankDept) {
        return appRankDeptMapper.selectAppRankDeptList(appRankDept);
    }

    /**
     * 获取队伍排行榜列表
     *
     * @param appRankUser 查询条件
     * @return 结果
     */
    @Override
    public List<AppRankUser> getDeptRankList(AppRankUser appRankUser) {
        return appRankDeptMapper.getDeptRankList(appRankUser);
    }

    /**
     * 新增部门排名表
     *
     * @param appRankDept 部门排名表
     * @return 结果
     */
    @Override
    public int insertAppRankDept(AppRankDept appRankDept) {
        appRankDept.setCreateTime(DateUtils.getNowDate());
        return appRankDeptMapper.insertAppRankDept(appRankDept);
    }

    /**
     * 修改部门排名表
     *
     * @param appRankDept 部门排名表
     * @return 结果
     */
    @Override
    public int updateAppRankDept(AppRankDept appRankDept) {
        return appRankDeptMapper.updateAppRankDept(appRankDept);
    }

    /**
     * 批量删除部门排名表
     *
     * @param ids 需要删除的部门排名表主键
     * @return 结果
     */
    @Override
    public int deleteAppRankDeptByIds(Long[] ids) {
        return appRankDeptMapper.deleteAppRankDeptByIds(ids);
    }

    /**
     * 删除部门排名表信息
     *
     * @param id 部门排名表主键
     * @return 结果
     */
    @Override
    public int deleteAppRankDeptById(Long id) {
        return appRankDeptMapper.deleteAppRankDeptById(id);
    }
}
